#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n;
struct Node {
  int t, k;
  vector<int> x;
};
int cnt[100005];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  queue<Node> q;
  cin >> n;
  int ans = 0;
  rep(i, 1, n) {
    Node now;
    cin >> now.t >> now.k;
    now.x = vector<int>(now.k, 0);
    for (int& v : now.x) cin >> v;
    q.push(now);
    for (int v : now.x) {
      if (++cnt[v] == 1) ans++;
    }
    int pre = now.t - 86400;
    // add
    while (q.front().t <= pre) {
      Node& last = q.front();
      for (int v : last.x) {
        if (!--cnt[v]) ans--;
      }
      q.pop();
    }
    cout << ans << endl;
  }
  return 0;
}